import {
	UserAgreementURL,
	PrivacyPolicyURL,
	VIPServiceAgreementURL,
} from '@/config/index.js'

export const useWebView = () => {
	
	// 查看用户协议
	const showUserAgreement = (title = '用户协议') => {
		uni.navigateTo({
			url: `/pagesC/webview/webview?url=${encodeURIComponent(UserAgreementURL)}&title=${encodeURIComponent(title)}`
		})
	}
	
	// 查看隐私政策
	const showPrivacyPolicy = (title = '隐私政策') => {
		uni.navigateTo({
			url: `/pagesC/webview/webview?url=${encodeURIComponent(PrivacyPolicyURL)}&title=${encodeURIComponent(title)}`
		})
	}
	
	// 查看会员服务协议
	const showVIPServiceAgreement = (title = '会员服务协议') => {
		uni.navigateTo({
			url: `/pagesC/webview/webview?url=${encodeURIComponent(VIPServiceAgreementURL)}&title=${encodeURIComponent(title)}`
		})
	}
	
	return {
		showUserAgreement,
		showPrivacyPolicy,
		showVIPServiceAgreement,
	}
}